<!DOCTYPE html>

<!--
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->

<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <title>polymer-gestures testing ground</title>
    <style>
      * {
        -webkit-user-select: none;
      }
      body, html {
        margin: 0;
        height: 100%;
        position: relative;
      }
      body {
        overflow: auto;
      }
      #capture {
        background-color: orange;
        height: 70%;
        width: 100%;
        position: absolute;
        top: 0;
      }
      #wrapper {
        position: absolute;
        bottom: 0;
        width: 100%;
        height: 30%;
        overflow: scroll;
        white-space: pre;
        margin: 0 auto;
        background: #f8f8f8;
        font-family: Consolas, "Liberation Mono", Courier, monospace;
        color: #333333;
        font-size: 12px;
      }

      #output {
         margin:0;
         padding: 5px;
      }
    </style>
    <script src="../../polymer-gestures.js"></script>
    <script src="../../test/js/fake.js"></script>
  </head>
  <body touch-action="none">
    <div id="capture">
    </div>
    <div id="wrapper">
      <div id="output"></div>
    </div>
    <script>
      var events = [
        // base events
        'pinch',
        'pinchstart',
        'pinchend',
        'rotate'
      ];
      find('capture', 'output');
      events.forEach(function(en) {
        PolymerGestures.addEventListener(capture, en, function(inEvent) {
          appendOutput(inEvent.type + ' [' + inEvent.scale + ']');
          inEvent.preventDefault();
        });
      });
      function find(/*...inEls*/) {
        [].forEach.call(arguments, function(e) {
          window[e] = document.getElementById(e);
        });
      }
      function appendOutput(inString) {
        var it = output.textContent;
        output.textContent = inString + '\n' + it;
      }
    </script>
  </body>
</html>
